class Solution(object):
    def toGoatLatin(self, sentence):
        """
        :type sentence: str
        :rtype: str
        """
        vowels = set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'])
        words = sentence.split()
        for i in range(len(words)):
            if words[i][0] in vowels:
                words[i] += 'ma' + 'a'*(i+1)
            else:
                words[i] = words[i][1:] + words[i][0] +'ma' + 'a'*(i+1)
        return ' '.join(words)
if __name__ == '__main__':
    sentence = "I speak Goat Latin"
    print(Solution().toGoatLatin(sentence))